package com.tudouji.project.customer.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.customer.domain.Financeinfo;
import com.tudouji.project.customer.service.IFinanceinfoService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 财务情况Controller
 * 
 * @author tudouji
 * @date 2022-05-18
 */
@RestController
@RequestMapping("/customer/financeinfo")
public class FinanceinfoController extends BaseController
{
    @Autowired
    private IFinanceinfoService financeinfoService;

    /**
     * 查询财务情况列表
     */
    @PreAuthorize("@ss.hasPermi('customer:financeinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(Financeinfo financeinfo)
    {
        startPage();
        List<Financeinfo> list = financeinfoService.selectFinanceinfoList(financeinfo);
        return getDataTable(list);
    }

    /**
     * 导出财务情况列表
     */
    @PreAuthorize("@ss.hasPermi('customer:financeinfo:export')")
    @Log(title = "财务情况", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Financeinfo financeinfo)
    {
        List<Financeinfo> list = financeinfoService.selectFinanceinfoList(financeinfo);
        ExcelUtil<Financeinfo> util = new ExcelUtil<Financeinfo>(Financeinfo.class);
        return util.exportExcel(list, "financeinfo");
    }

    /**
     * 获取财务情况详细信息
     */
    @PreAuthorize("@ss.hasPermi('customer:financeinfo:query')")
    @GetMapping(value = "/{guid}")
    public AjaxResult getInfo(@PathVariable("guid") String guid)
    {
        return AjaxResult.success(financeinfoService.selectFinanceinfoById(guid));
    }

    /**
     * 新增财务情况
     */
    @PreAuthorize("@ss.hasPermi('customer:financeinfo:add')")
    @Log(title = "财务情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Financeinfo financeinfo)
    {
        return toAjax(financeinfoService.insertFinanceinfo(financeinfo));
    }

    /**
     * 修改财务情况
     */
    @PreAuthorize("@ss.hasPermi('customer:financeinfo:edit')")
    @Log(title = "财务情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Financeinfo financeinfo)
    {
        return toAjax(financeinfoService.updateFinanceinfo(financeinfo));
    }

    /**
     * 删除财务情况
     */
    @PreAuthorize("@ss.hasPermi('customer:financeinfo:remove')")
    @Log(title = "财务情况", businessType = BusinessType.DELETE)
	@DeleteMapping("/{guids}")
    public AjaxResult remove(@PathVariable String[] guids)
    {
        return toAjax(financeinfoService.deleteFinanceinfoByIds(guids));
    }
}
